//FYI: https://github.com/Tencent/puerts/blob/master/doc/unity/manual.md

import FairyEditor = CS.FairyEditor;
import ToolPlugin from "./ToolPlugin";

const App = FairyEditor.App;

console.log("ToolPlugin enter");

ToolPlugin.instance;

// 自定义发布代码
function onPublish(handler: CS.FairyEditor.PublishHandler) {
    if (!handler.genCode) return;
    console.log("[color=#ffff00]on publish code[/color] => [u][b]" + handler.pkg.name + "[/b][/u]");
    handler.genCode = false; //prevent default output
}

function onPublishEnd(pkgs: CS.System.Array$1<CS.FairyEditor.FPackage>) {
    console.log("[color=#00ff00]on publish end[/color]", pkgs.Length);
}

// 插件销毁
function onDestroy() {
    App.groot.onKeyDown.Remove(onKeyDown);
    ToolPlugin.destroy();
}

App.groot.onKeyDown.Set(onKeyDown);

function onKeyDown(evt: CS.FairyGUI.EventContext) {}

export { onPublish, onPublishEnd, onDestroy };
